clear
set more off
cd "INSERT FILE PATH HERE"

set matsize 11000

*******************
* Cohorts 3 and 4 *
*******************

use "pnad-pseudo-panel.dta", clear

* Table C6
logit race2 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state), robust

* Table C7
margins, at(year=(1993 1998 2003 2008 2013 2015) educ1=(1(1)4)) noestimcheck force

* Table C8 
margins r.year@educ1, contrast noestimcheck force

* Table C9
logit race2 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 < 10, robust
logit race2 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 < 6, robust
logit race2 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 > 9, robust

* Table C10
logit race2 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 < 10, robust
margins, at(year=(1993 1998 2003 2008 2013 2015) educ1=(1(1)4)) noestimcheck force

* Table C11
logit race2 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 < 10, robust
margins r.year@educ1, contrast noestimcheck force

* Table C12
logit race2 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 < 6, robust
margins, at(year=(1993 1998 2003 2008 2013 2015) educ1=(1(1)4)) noestimcheck force

* Table C13
logit race2 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 < 6, robust
margins r.year@educ1, contrast noestimcheck force

* Table C14
logit race2 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 > 9, robust
margins, at(year=(1993 1998 2003 2008 2013 2015) educ1=(1(1)4)) noestimcheck force

* Table C15
logit race2 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 > 9, robust
margins r.year@educ1, contrast noestimcheck force

*NOTE: Stata may not compute standard errors for mlogit models due to an unknown error. If this occurs, close Stata, reload data, and run again. This may require several attempts.

* Table C26
mlogit race3 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 < 10, robust base(1)

* Table C27
mlogit race3 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 < 10, robust base(1)
margins, at(year=(1993 1998 2003 2008 2013 2015) educ1=(1(1)4)) noestimcheck force

* Table C28
mlogit race3 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 < 10, robust base(1)
margins r.year@educ1, contrast noestimcheck force predict(outcome(1)) /* White ID */
margins r.year@educ1, contrast noestimcheck force predict(outcome(2)) /* Brown ID */
margins r.year@educ1, contrast noestimcheck force predict(outcome(3)) /* Black ID */

***************
* All Cohorts *
***************

clear

use "pnad-pseudo-panel-allcohorts.dta", clear

* Table C16
logit race2 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state), robust

* Table C17
margins, at(year=(1993 1998 2003 2008 2013 2015) educ1=(1(1)4)) noestimcheck force

* Table C18 
margins r.year@educ1, contrast noestimcheck force

* Table C19
logit race2 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 < 10, robust
logit race2 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 < 6, robust
logit race2 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 > 9, robust

* Table C20
logit race2 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 < 10, robust
margins, at(year=(1993 1998 2003 2008 2013 2015) educ1=(1(1)4)) noestimcheck force

* Table C21
logit race2 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 < 10, robust
margins r.year@educ1, contrast noestimcheck force

* Table C22
logit race2 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 < 6, robust
margins, at(year=(1993 1998 2003 2008 2013 2015) educ1=(1(1)4)) noestimcheck force

* Table C23
logit race2 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 < 6, robust
margins r.year@educ1, contrast noestimcheck force

* Table C24
logit race2 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 > 9, robust
margins, at(year=(1993 1998 2003 2008 2013 2015) educ1=(1(1)4)) noestimcheck force

* Table C25
logit race2 i.year##(i.educ1 c.income3 female native migrant_state c.lag i.state) if income3 > 9, robust
margins r.year@educ1, contrast noestimcheck force







